import Vue from 'vue'
import Router from 'vue-router'

// in development-env not use lazy-loading, because lazy-loading too many pages will cause webpack hot update too slow. so only in production use lazy-loading;
// detail: https://panjiachen.github.io/vue-element-admin-site/#/lazy-loading

Vue.use(Router)

/* Layout */
import Layout from '../views/layout/Layout'

/**
* hidden: true                   if `hidden:true` will not show in the sidebar(default is false)
* alwaysShow: true               if set true, will always show the root menu, whatever its child routes length
*                                if not set alwaysShow, only more than one route under the children
*                                it will becomes nested mode, otherwise not show the root menu
* redirect: noredirect           if `redirect:noredirect` will no redirect in the breadcrumb
* name:'router-name'             the name is used by <keep-alive> (must set!!!)
* meta : {
    title: 'title'               the name show in submenu and breadcrumb (recommend set)
    icon: 'svg-name'             the icon show in the sidebar,
  }
**/
export const constantRouterMap = [
  { path: '/login', component: () => import('@/views/login/index'), hidden: true },
  { path: '/404', component: () => import('@/views/404'), hidden: true },

  {
    path: '/',
    component: Layout,
    redirect: '/dashboard',
    name: 'Dashboard',
    hidden: true,
    children: [{
      path: 'dashboard',
      //路由对应的页面  @/ = ./
      component: () => import('@/views/dashboard/index')
    }]
  },
  {
    path: '/patent',
    component: Layout, //布局
    //  默认访问地址
    redirect: '/patent/table', //访问父path:'/patent'时，直接访问'/teacher/table'
    name: '专利查询',
    meta: { title: '专利查询', icon: 'example' },//显示的名字和图标
    children: [
      {
        path: 'table',
        name: '专利列表',
        component: () => import('@/views/patentshow/patent/list'),//页面vue组件文件路径
        meta: { title: '专利列表', icon: 'table' }//左侧栏显示的名字和图标
      },
      {
        path: 'save',
        name: '精准查询',
        component: () => import('@/views/patentshow/patent/accurate'),
        meta: { title: '精准查询', icon: 'tree' }
      },{
        path: 'detail/:id',
        name: '专利详情',
        component: () => import('@/views/patentshow/patent/detail'),
        meta: { title: '专利详情', icon: 'tree' },
        hidden:true
      }
    ]
  },
  {
    path: '/company',
    component: Layout,
    //  默认访问地址
    redirect: '/company/list', 
    name: '企业查询',
    meta: { title: '企业查询', icon: 'example' },
    children: [
      {
        path: 'list',
        name: '企业查询',
        component: () => import('@/views/patentshow/company/list'),
        meta: { title: '企业查询', icon: 'table' }
      },
      { //还没用
        path: 'detail/:id',
        name: '企业详情',
        component: () => import('@/views/patentshow/company/detail'),
        meta: { title: '企业详情', icon: 'tree' },
        hidden:true //侧边栏隐藏
      },
    ]
  },
  {
    path: '/inventor',
    component: Layout,
    redirect: '/inventor/list',
    name: '发明人管理',
    meta: { title: '人才查询', icon: 'example' },
    children: [
      {
        path: 'list',
        name: '人名查询',
        component: () => import('@/views/patentshow/inventor/list'),
        meta: { title: '人名查询', icon: 'table' }
      },
      {
        path: 'detail/:inventorname/:companyname',
        name: '发明人专利列表',
        component: () => import('@/views/patentshow/inventor/detailList'),
        meta: { title: '关键字查询-还没写', icon: 'tree' },
        hidden:true
      }
    ]
  },
  {//这个path没用上，因此是hidden:true,
    path: '/course',
    component: Layout,
    //  默认访问地址
    redirect: '/course/list', 
    name: '课程管理',
    meta: { title: '课程管理', icon: 'nested' },
    hidden:true,
    children: [
      {
        path: 'list',
        name: '课程列表',
        component: () => import('@/views/edu/course/list'),
        meta: { title: '课程列表', icon: 'table' }
      },
      {
        path: 'info',
        name: '添加课程基本信息',
        component: () => import('@/views/edu/course/info'),
        meta: { title: '添加课程', icon: 'tree' }
      },
      {
        path: 'info/:id',
        name: '修改课程基本信息',
        component: () => import('@/views/edu/course/info'),
        meta: { title: '添加课程', icon: 'tree' },
        hidden:true
      },
      {
        path: 'chapter/:id',
        name: '创建大纲',
        component: () => import('@/views/edu/course/chapter'),
        meta: { title: '创建大纲', icon: 'tree' },
        hidden:true
      },
      {
        path: 'publish/:id',
        name: '最终发布',
        component: () => import('@/views/edu/course/publish'),
        meta: { title: '最终发布', icon: 'tree' },
        hidden:true
      },
    ]
  },
  {
    path: '/sta',
    component: Layout,
    redirect: '/sta/creat',
    name: '统计分析',
    meta: { title: '统计分析', icon: 'example' },
    children: [
      {
        path: 'companyEcharts',
        name: '公司分析',
        component: () => import('@/views/patentshow/echartsGraph/companyechartsgragh'),
        meta: { title: '公司分析', icon: 'table' }
      },
      {
        path: 'patentanalysis',
        name: '专利分析',
        component: () => import('@/views/patentshow/echartsGraph/zhuanlifenxi'),
        meta: { title: '专利分析', icon: 'table' }
      },
      {
        path: 'zhuzhuangtu',
        name: '图1-柱状图',
        component: () => import('@/views/patentshow/echartsGraph/zhuzhuangtu'),
        meta: { title: '图1-柱状图', icon: 'table' },
        hidden:true
      },
      {
        path: 'ipcfenxi',
        name: '图2-ipc分析图',
        component: () => import('@/views/patentshow/echartsGraph/shuanghuantu'),
        meta: { title: '图2-ipc分析图', icon: 'tree' },
        hidden:true
      },
      {
        path: 'shuanghuantu',
        name: '图3-双环图',
        component: () => import('@/views/patentshow/echartsGraph/shuanghuantu'),
        meta: { title: '图3-双环图', icon: 'tree' },
        hidden:true
      },{
        path: 'guojiazhuzhuangtu',
        name: '图4-国家柱状图',
        component: () => import('@/views/patentshow/echartsGraph/guojiazhuzhuangtu'),
        meta: { title: '图4-国家柱状图', icon: 'tree' },
        hidden:true
      },{
        path: 'zhuanlizhuzhuangtu',
        name: '图5-国家柱状图',
        component: () => import('@/views/patentshow/echartsGraph/zhuanlizhuzhuangtu'),
        meta: { title: '图5-国家柱状图', icon: 'tree' },
        hidden:true
      },{
        path: 'leidatu',
        name: '图7-雷达图',
        component: () => import('@/views/patentshow/echartsGraph/leidatu'),
        meta: { title: '图7-雷达图', icon: 'tree' },
        hidden:true
      }
    ]
  },
  {
    path: '/form',
    component: Layout,
    name: '专利图谱',
    meta: { title: '专利图谱', icon: 'example' },
    children: [
      {
        path: 'index/:id',
        name: '专利图谱',
        component: () => import('@/views/patentshow/graph/Canvas'),
        meta: { title: '专利图谱', icon: 'form' }
      }
    ]
  },

  {
    path: '/myinfo',
    component: Layout,
    redirect: '/myinfo/mycollcet',
    name: 'MyInfo',
    meta: {
      title: '我的信息',
      icon: 'nested'
    },
    children: [
      {
        path: 'mycollcet',
        component: () => import('@/views/myinfo/collectInfo'), // Parent router-view
        name: 'mycollcet',
        meta: { title: '我的收藏' },
      }
      // {
      //   path: 'menu2',
      //   component: () => import('@/views/nested/menu2/index'),
      //   meta: { title: 'menu2' }
      // }
    ]
  },

  {
    path: 'external-link',
    component: Layout,
    children: [
      {
        path: 'https://panjiachen.github.io/vue-element-admin-site/#/',
        meta: { title: 'External Link', icon: 'link' }
      }
    ]
  },

  { path: '*', redirect: '/404', hidden: true }
]

export default new Router({
  // mode: 'history', //后端支持可开
  scrollBehavior: () => ({ y: 0 }),
  routes: constantRouterMap
})
